package com.hinnotek.amoeba.adapters.old

import android.widget.CheckBox
import com.chad.library.adapter.base.BaseQuickAdapter
import com.hinnotek.amoeba.adapters.old.viewholder.ABaseViewHolder
import com.hinnotek.amoeba.bean.old.RDProjectListBean
import com.hinnotek.amoeba.R
import com.hinnotek.amoeba.bean.old.AmibaProjectListBean

class RdProjectListAdapter :
    BaseQuickAdapter<AmibaProjectListBean, ABaseViewHolder>(R.layout.item_rd_project_list) {
    override fun convert(holder: ABaseViewHolder, item: AmibaProjectListBean) {
        if (item.select == 0) {
            holder.setChecked(R.id.cb, false)
        } else {
            holder.setChecked(R.id.cb, true)
        }
        holder.setText(R.id.tv_rd_project_name, item.projectName)
        holder.itemView.setOnClickListener {
            val checkBox = holder.getView<CheckBox>(R.id.cb)
            if (checkBox.isChecked) {
                item.select = 1
            } else {
                item.select = 0
            }
        }
    }
}